package com.xtpt.disaster.bean;


import com.xtpt.disaster.common.consts.IntervalTypeEnum;
import com.xtpt.disaster.common.consts.ScheduleTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 任务类
 */
@Data
@Component
public class QuartzEntity{
    /**
     * 1、任务名称
     */
    @ApiModelProperty(value = "任务名称")
    private String jobName;
    /**
     *2、任务分组(弃用)
     */
    @Deprecated
    @ApiModelProperty(value = "任务分组(弃用)")
    private String jobGroup;
    /**
     *3、任务描述
     */
    @ApiModelProperty(value = "任务描述")
    private String description;
    /**
     *4、执行任务的类名
     */
    @ApiModelProperty(value = "执行任务的类名")
    private String jobClassName;
    /**
     *5、执行时间表达式（Cron表达式）
     */
    @ApiModelProperty(value = "执行时间表达式（Cron表达式）")
    private String cronExpression;//执行时间
    /**
     *6、触发器名
     */
    @ApiModelProperty(value = "触发器名")
    private String triggerName;//触发器名
    /**
     *7、任务状态
     */
    @ApiModelProperty(value = "任务状态")
    private String triggerState;//任务状态
    /**
     *8、原任务名称 用于修改
     */
    @ApiModelProperty(value = "原任务名称 用于修改")
    private String oldJobName;
    /**
     *9、原任务分组 用于修改(弃用)
     */
    @Deprecated
    @ApiModelProperty(value = "原任务分组 用于修改(弃用)")
    private String oldJobGroup;//
    /**
     *10、任务执行方式类型（0=立即、1=定点一次性、2=周期）
     */
    @ApiModelProperty(value = "任务执行方式类型")
    private ScheduleTypeEnum scheduleType;
    /**
     * 11、周期类型（0=日、1=周、2=月、3=年）
     */
    @ApiModelProperty(value = "周期类型（0=日、1=周、2=月、3=年）")
    private IntervalTypeEnum intervalType;
    /**
     * 12、指定周期单位数量
     */
    @ApiModelProperty(value = "taskUnitCount")
    private Integer taskUnitCount;
    /**
     * 13、存储回调参数信息
     */
    @ApiModelProperty(value = "存储回调参数信息")
    private ActionParameters actionParameters;

    /**
     * 14、任务开始时间
     */
    @ApiModelProperty(value = "任务开始时间")
    private Date startAt;

    /**
     * 15、任务终止时间
     */
    @ApiModelProperty(value = "任务终止时间")
    private Date endAt;

    public QuartzEntity() {
    }

    public QuartzEntity(String jobName, String jobGroup, String description, ScheduleTypeEnum scheduleType, IntervalTypeEnum intervalType, Integer taskUnitCount, ActionParameters actionParameters, Date startAt, Date endAt) {
        this.jobName = jobName;
        this.description = description;
        this.scheduleType = scheduleType;
        this.intervalType = intervalType;
        this.taskUnitCount = taskUnitCount;
        this.actionParameters = actionParameters;
        this.startAt = startAt;
        this.endAt = endAt;
    }

    public QuartzEntity(String jobName, String jobGroup, String description, String jobClassName, String cronExpression, String triggerName, String triggerState, String oldJobName, String oldJobGroup, ScheduleTypeEnum scheduleType, IntervalTypeEnum intervalType, Integer taskUnitCount, ActionParameters actionParameters, Date startAt, Date endAt) {
        this.jobName = jobName;
        this.description = description;
        this.jobClassName = jobClassName;
        this.cronExpression = cronExpression;
        this.triggerName = triggerName;
        this.triggerState = triggerState;
        this.oldJobName = oldJobName;
        this.scheduleType = scheduleType;
        this.intervalType = intervalType;
        this.taskUnitCount = taskUnitCount;
        this.actionParameters = actionParameters;
        this.startAt = startAt;
        this.endAt = endAt;
    }
}
